<?php
/**
 * Created by PhpStorm.
 * User: 王世鹏
 * Date: 2018/3/8
 * Time: 13:45
 */

namespace app\index\controller;
use app\index\model\User as UserModel;

class Demo
{
    public function index()
    {
        return view("demo/index",["k"=>"233"]);
    }
    public function add()
    {
        $user = new UserModel();
        if($user->allowField(true)->save(input("post."))){
            return "{$user->nickname} 编号:{$user->id}添加成功";
        }
        else{
            return $user->getError();
        }
    }

}